#ifndef TWEETVIEW_H
#define TWEETVIEW_H

#include "fanfou_global.h"
#include <QWidget>
#include <QPushButton>

namespace Fanfou
{
	class FanfouFrame;
	class FanfouTweet;
	class TweetFrame;
	class TweetView : public QWidget
	{
		Q_OBJECT
		public:
			explicit TweetView( FanfouFrame* parent = 0 );
			int height();

			void updateTimeInfo();
			void ensureChildrenWidth(int width);

			void markRead(FanfouId);

			void updateData(const QList<FanfouTweet>& tweets,const QVector<FanfouId>& deletedIds);
		signals:
			void fetchOldData();
		private slots:
			void updateLayout(TweetFrame*);
			void tweetRemoved(const FanfouTweet&);
			void oldDataBtnClicked();
		private:
			FanfouFrame* m_parent;
			QList<TweetFrame*> m_tweetFrames;
			QHash<FanfouId,TweetFrame*> m_tweetFrameMap;
			QPushButton m_getOldDataBtn;

			QList<FanfouId> m_unreadList;

			void updateLayout(int i,int y);
	};
} // namespace Fanfou

#endif // TWEETVIEW_H
